package com.logic.landseaserver.domain;

import java.sql.Timestamp;
import java.util.Date;
/**
 * @Author: jack
 * @Date: 2017/5/23
 * @Description: 账单支付类
 */
public class BillPayment {
        
    private Integer id;

    private Integer billId;

    private String payType;

    private Date time;

    private Double money;

    private String transactionNo;

    private String orderNo;

    private String bank;

    private String status;

	private String comments;

    private String imageId;
    
    private String billType;

    private Date createdDtm;

    private Integer createdBy;

    private Date lastModifiedDtm;

    private Integer lastModifiedBy;

    private Integer version;

    private Boolean deleted;
    
    /** 是否需要校验金额 **/
    private boolean isNeedCheckMoney = true;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getPayType() {
		return payType;
	}

	public void setPayType(String payType) {
		this.payType = payType;
	}

	public Date getTime() {
		return time;
	}

	public void setTime(Date time) {
		this.time = time;
	}

	public Double getMoney() {
		return money;
	}

	public void setMoney(Double money) {
		this.money = money;
	}

	public String getTransactionNo() {
		return transactionNo;
	}

	public void setTransactionNo(String transactionNo) {
		this.transactionNo = transactionNo;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getBank() {
		return bank;
	}

	public void setBank(String bank) {
		this.bank = bank;
	}

	public String getImageId() {
		return imageId;
	}

	public void setImageId(String imageId) {
		this.imageId = imageId;
	}

	public String getBillType()
    {
        return billType;
    }

    public void setBillType(String billType)
    {
        this.billType = billType;
    }

    public Integer getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Integer createdBy) {
		this.createdBy = createdBy;
	}

	public Date getLastModifiedDtm() {
		return lastModifiedDtm;
	}

	public void setLastModifiedDtm(Date lastModifiedDtm) {
		this.lastModifiedDtm = lastModifiedDtm;
	}

	public Integer getLastModifiedBy() {
		return lastModifiedBy;
	}

	public void setLastModifiedBy(Integer lastModifiedBy) {
		this.lastModifiedBy = lastModifiedBy;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public Boolean getDeleted() {
		return deleted;
	}

	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	public Integer getBillId() {
		return billId;
	}

	public void setBillId(Integer billId) {
		this.billId = billId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getCreatedDtm() {
		return createdDtm;
	}



	public void setCreatedDtm(Date createdDtm) {
		this.createdDtm = createdDtm;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public void updateCommonInfo(Integer userId) {

      Timestamp now = new Timestamp(new Date().getTime());
      if (this.getId() == null || this.getId() == 0) { // New PoJo
        this.setVersion(0);
        if (this.getCreatedDtm() == null) {
          this.setCreatedDtm(now);
        }
        if (this.getCreatedBy() == null || this.getCreatedBy().equals(0)) {
          this.setCreatedBy(userId == null ? 0 : userId);
        }
        this.setLastModifiedDtm(now);
        this.setLastModifiedBy(userId == null ? 0 : userId);
        this.setDeleted(false);

      } else { // Update this
        this.setVersion(this.getVersion() == null ? 1 : this.getVersion() + 1);
        this.setLastModifiedDtm(now);
        if (userId.equals(-1)) {
        } else {
          this.setLastModifiedBy(userId == null ? 0 : userId);
        }
      }
    }
	
    public boolean isNeedCheckMoney()
    {
        return isNeedCheckMoney;
    }

    public void setNeedCheckMoney(boolean isNeedCheckMoney)
    {
        this.isNeedCheckMoney = isNeedCheckMoney;
    }

    @Override
    public String toString()
    {
        return "BillPayment [id=" + id + ", billId=" + billId + ", payType=" + payType + ", time=" + time + ", money="
            + money + ", transactionNo=" + transactionNo + ", orderNo=" + orderNo + ", bank=" + bank + ", status="
            + status + ", comments=" + comments + ", imageId=" + imageId + ", billType=" + billType + ", createdDtm="
            + createdDtm + ", createdBy=" + createdBy + ", lastModifiedDtm=" + lastModifiedDtm + ", lastModifiedBy="
            + lastModifiedBy + ", version=" + version + ", deleted=" + deleted + ", isNeedCheckMoney="
            + isNeedCheckMoney + "]";
    }
}